/*
 * gcd.c - The Euclidean algorithm
 */

int
gcd_rec(int a, int b) { return b == 0 ? a : gcd_rec(b, a % b); }

int
gcd_ite_div(int a, int b)
{
  int c;
  while (b != 0) {
    c = b;
    b = a % b;
    a = c;
  }
  return a;
}

int
gcd_ite_sub(int a, int b)
{
	if (a == 0)
		return b;
	while (b != 0)
		if (a > b)
			a -= b;
		else
			b -= a;
	return a;
}
